<template>
	<view class="app-item" hover-class="u-cell-hover">
		<view class="title" @tap="btnLClick">
			<u-icon class="icon" :color="iconColor" :name="iconName" :size='iconSize' />
			<text>{{title}}</text>
		</view>
		<view v-if="showRight" class="right-icon" @tap="btnRClick">
			<u-icon name="search" :size='26' color="#aaadad" />
		</view>
	</view>
</template>

<script>
	export default {
		name: "cx-app-cell",
		props: {
			// 标题
			title: {
				type: String,
				default: "标题"
			},
			showRight: {
				type: Boolean,
				default: true
			},
			// icon size
			iconSize: {
				type: Number,
				default: 26
			},
			// icon name
			iconName: {
				type: String,
				default: "order"
			},
			// icon color
			iconColor: {
				type: String,
				default: "#3d7ff7"
			}
		},
		data() {
			return {

			}
		},
		methods: {
			btnLClick() {
				this.$emit("on-l-click")
			},
			btnRClick() {
				this.$emit("on-r-click")
			}
		}
	}
</script>

<style lang="scss" scoped>
	.app-item {
		border-top: #eeeeee solid 1rpx;
		border-radius: 10rpx;
		padding: 30rpx;
		background: #fff;
		display: flex;

		align-items: center;

		.title {
			flex: 1;
			text-align: left;
			display: flex;
			align-items: center;
			color: #2b2b2b;

			.icon {
				font-size: 60rpx;
				width: 60rpx;
			}
		}

		.right-icon {
			width: 80rpx;
		}
	}
</style>
